﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microhard.WeixinMP.Interfaces;
using Microhard.WeixinMP.Models;
using Microhard.Core.Extensions;
using HtmlAgilityPack;
using System.ServiceModel.Dispatcher;

namespace Microhard.WeixinMP.Impls
{
    public class Web_ParseUsers : IWeixinMPHtmlParser<List<WeixinUserBasicModel>>
    {
        public List<WeixinUserBasicModel> ParseObject(string html)
        {
            HtmlDocument doc = new HtmlDocument();
            doc.LoadHtml(html);
            var jsonArr = doc.GetElementbyId("json-friendList");
            JsonQueryStringConverter jqsv = new JsonQueryStringConverter();
            return (List<WeixinUserBasicModel>)jqsv.ConvertStringToValue(jsonArr.InnerText, typeof(List<WeixinUserBasicModel>));
        }
    }
}
